package com.soft.controller;

import com.soft.service.StudentAnyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

@Controller//该注解的意思就是表示该类是一个控制器
public class HelloContrller2 {

    @Autowired //将spring 容器中的StudentAnyService的实现类赋值给当前的类成员变量
    private StudentAnyService studentAnyService;

//    @ResponseBody//功能1：如果方法的返回值是字符串，就原样返回。功能2：如果方法的返回值是对象类型，那么会将对象转换成json数据返回
//    @RequestMapping("/hello2")//该注解提供控制器的对外访问路径
//    public String hello2(){
//        return "hello,springboot2222~";
//    }

    @ResponseBody
    @RequestMapping("/listClassesInfo")
    public List<Map<String, Object>> listClassesInfo(){
        return studentAnyService.listClassesInfo();
    }

    @ResponseBody
    @RequestMapping("/findClassesCoreTaskCompleteRate")
    public Map findClassesCoreTaskCompleteRate(){
        return studentAnyService.findClassesCoreTaskCompleteRate();
    }

    @ResponseBody
    @RequestMapping("/findClassesCoreSubmitRate")
    public Map findClassesCoreSubmitRate(){
        return studentAnyService.findClassesCoreSubmitRate();
    }

    @ResponseBody
    @RequestMapping("/findClassesCoreTaskCompleteRateLt40")
    public Map findClassesCoreTaskCompleteRateLt40(){
        return studentAnyService.findClassesCoreTaskCompleteRateLt40();
    }
    @ResponseBody
    @RequestMapping("/findClassesCoreTaskCompleteRateGt80")
    public Map findClassesCoreTaskCompleteRateGt80(){
        return studentAnyService.findClassesCoreTaskCompleteRateGt80();
    }

    @ResponseBody
    @RequestMapping("/listClassesCoreTaskCompleteRateLt40")
    public List<Map<String, Object>> listClassesCoreTaskCompleteRateLt40(){
        return studentAnyService.listClassesCoreTaskCompleteRateLt40();
    }

    @ResponseBody
    @RequestMapping("/listAllClassTotalAndAvgScore")
    public List<Map<String, Double>> listAllClassTotalAndAvgScore(){
        return studentAnyService.listAllClassTotalAndAvgScore();
    }

    @ResponseBody
    @RequestMapping("/listEveryClassAvgScore")
    public List<Map<String, Object>> listEveryClassAvgScore(){
        return studentAnyService.listEveryClassAvgScore();
    }

    @ResponseBody
    @RequestMapping("/listStudentLevelCount")
    public Map listStudentLevelCount(){
        return studentAnyService.listStudentLevelCount();
    }

    @ResponseBody
    @RequestMapping("/listEveryClassesCoreTaskCompleteRateAndCoreSubmitRate")
    public List<Map<String, Object>> listEveryClassesCoreTaskCompleteRateAndCoreSubmitRate(){
        return studentAnyService.listEveryClassesCoreTaskCompleteRateAndCoreSubmitRate();
    }
}
